<template>
	<view class="vote">
		<view class="ctitle" style="">投票选项(可多选)</view>
		<view style="margin: 20rpx 20rpx 0 20rpx;">
			<view :class="item.selected?'skillbar active':'skillbar'" v-for="(item,index) in voteList" :key="index"
				@click="selectVote(item, index)">
				<view class="skillbar-title"><text>{{item.name}}</text></view>
				<view :class="item.selected?'skillbar-bar active':'skillbar-bar'" :animation="animationData[index]">
				</view>
				<view class="skill-bar-percent">票数：{{item.votes}}</view>
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {

			}
		},
		props: {
			animationData: {
				type: Array
			},
			voteList: {
				type: Array
			}
		},
		onLoad() {

		},
		methods: {
			selectVote(item, index) {
				this.$emit("pSelectVote", item, index);
			}
		}
	}
</script>
<style lang="scss" scoped>
	.vote {
		// padding: 0 -60rpx;
		overflow: hidden;
	}

	.skillbar {
		position: relative;
		display: block;
		margin-bottom: 10px;
		width: 100%;
		background: #eee;
		height: 35px;
		border-radius: 3px;
	}

	.skillbar-title {
		position: absolute;
		top: 0;
		left: 0;
		width: 150px;
		font-weight: 700;
		font-size: 13px;
		color: #fff;
	}

	.skillbar-title text {
		display: block;
		padding: 0 20px;
		height: 35px;
		line-height: 35px;
	}

	.skillbar-bar {
		height: 35px;
		width: 0px;
		background: #cbcbcb;
		border-radius: 3px;
	}

	.skill-bar-percent {
		position: absolute;
		right: 10px;
		top: 0;
		font-size: 11px;
		height: 35px;
		line-height: 35px;
		color: #fff;
		color: rgba(0, 0, 0, .4)
	}

	.ctitle {
		width: 100%;
		height: 40px;
		background-color:
			#eee;
		color: #B0B0B0;
		line-height: 40px;
		font-size: 14px;
		padding-left: 16px;
	}

	.active {
		background-color: $echo-main-color;
	}
</style>
